package com.xyh.transaction.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class OrderNumberGenerator {
    public static String generateOrderNumber() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMddHHmmssSSS");
        String timestamp = dateFormat.format(new Date());

        Random random = new Random();
        int randomPart = random.nextInt(10000);
        String randomPartString = String.format("%04d", randomPart);

        return "YW" + timestamp + randomPartString;
    }

    public static void main(String[] args) {
        String orderNumber = generateOrderNumber();
        System.out.println("Order Number: " + orderNumber);
    }
}
